package com.gxar.quick.ar.server.base.common.enums.device;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 设备渠道
 *
 * @author zxh
 * @version 1.0
 * @created 2024/02/26.
 */
@Getter
public enum DevicePlatformEnum {

    IOS("ios", "iOS微信（包含 iPhone、iPad）"),
    ANDROID("android", "Android"),
    WINDOWS("windows", "Windows"),
    MAC("mac", "macOS"),
    DEVTOOLS("devtools", "开发者工具"),

    ;

    private final String name;
    private final String desc;

    DevicePlatformEnum(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    @JsonCreator
    public static DevicePlatformEnum getByName(String name) {
        Optional<DevicePlatformEnum> targetEnum = Arrays.stream(DevicePlatformEnum.values()).filter(e -> e.getName().equals(name)).findFirst();
        return targetEnum.orElse(null);
    }
}
